package FollowME;

import java.io.Serializable;

import birdsong.comm.ServerSideMessage;

/**
 * Class that defines the messages from client to server.
 * This class implements the interfaces serializable and ServerSideMessage
 * 
 * @author group50
 */
public class ClientToServerMessage implements Serializable, ServerSideMessage {

	private static final long serialVersionUID = 1L;
	private Type type;
	private String payload;
	private String nickname;

	/**
	 * The ClientToServerMessage Constructor.
	 * This constructor receives the type of message that client wants to send to server
	 * Also receives the payload of that message
	 * And the nickname of the user sending the message.
	 * 
	 * @param type, type of message
	 * @param payload, payload of message
	 * @param nickname, nickname of user
	 */
	public ClientToServerMessage(Type type, String payload, String nickname) {
		this.type = type;
		this.payload = payload;
		this.nickname = nickname;
	}


	 /**
     * @return the type of the message.
     */ 
	@Override
	public Type getType() {
		return type;
	}

	/**
     * @return the message payload.
     */
	@Override
	public String getPayload() {
		return payload;
	}

	
	/**
     * @return client's nickname.
     */
	@Override
	public String getClientNickname() {
		return nickname;
	}

}
